package interpreter;

/**
 * @author wcj
 * @Date 2021/7/12 18:46
 * @Version 1.0
 */
public class Client {

    public static Expression getManExpression() {
        TerminalExpression wcj = new TerminalExpression("wcj");
        TerminalExpression male = new TerminalExpression("male");
        return new AndExpression(wcj, male);
    }

    public static Expression getMarriedWomanExpression() {
        TerminalExpression bss = new TerminalExpression("bss");
        TerminalExpression woman = new TerminalExpression("married");
        return new OrExpression(bss, woman);
    }

    public static void main(String[] args) {
        Expression manExpression = getManExpression();
        System.out.println("wcj is male?" + manExpression.interpreter("wcj is male"));
        Expression marriedWomanExpression = getMarriedWomanExpression();
        System.out.println("bss is married woman?" + marriedWomanExpression.interpreter("bss"));
    }
}
